<?php


class ServiceSubscriberMapping extends CActiveRecord
{
	
	public static function model($Vgmajjibziuy=__CLASS__)
	{
		return parent::model($Vgmajjibziuy);
	}

	
	public function tableName()
	{
		return 'service_subscriber_mapping';
	}

	
	public function rules()
	{
		
		
		return array(
			array('service_id, subscriber_id, create_date', 'required'),
			array('service_id, subscriber_id, is_active, is_deleted', 'numerical', 'integerOnly'=>true),
			array('description', 'length', 'max'=>1000),
			array('activate_date, expiry_date, modify_date', 'safe'),
			
			
			array('id, service_id, subscriber_id, description, activate_date, expiry_date, is_active, create_date, modify_date, is_deleted', 'safe', 'on'=>'search'),
		);
	}

	
	public function relations()
	{
		
		
		return array(
			'service' => array(self::BELONGS_TO, 'Service', 'service_id'),
			'subscriber' => array(self::BELONGS_TO, 'Subscriber', 'subscriber_id'),
			'subscriberServiceAttributeValues' => array(self::HAS_MANY, 'SubscriberServiceAttributeValue', 'service_subscriber_mapping_id'),
			'subscriberServiceConsumptions' => array(self::HAS_MANY, 'SubscriberServiceConsumption', 'service_subscriber_mapping_id'),
		);
	}

	
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'service_id' => 'Service',
			'subscriber_id' => 'Subscriber',
			'description' => 'Description',
			'activate_date' => 'Activate Date',
			'expiry_date' => 'Expiry Date',
			'is_active' => 'Is Active',
			'create_date' => 'Create Date',
			'modify_date' => 'Modify Date',
			'is_deleted' => 'Is Deleted',
		);
	}

	
	public function search()
	{
		
		

		$V0v5vsnfxezw=new CDbCriteria;

		$V0v5vsnfxezw->compare('id',$this->id);
		$V0v5vsnfxezw->compare('service_id',$this->service_id);
		$V0v5vsnfxezw->compare('subscriber_id',$this->subscriber_id);
		$V0v5vsnfxezw->compare('description',$this->description,true);
		$V0v5vsnfxezw->compare('activate_date',$this->activate_date,true);
		$V0v5vsnfxezw->compare('expiry_date',$this->expiry_date,true);
		$V0v5vsnfxezw->compare('is_active',$this->is_active);
		$V0v5vsnfxezw->compare('create_date',$this->create_date,true);
		$V0v5vsnfxezw->compare('modify_date',$this->modify_date,true);
		$V0v5vsnfxezw->compare('is_deleted',$this->is_deleted);

		return new CActiveDataProvider($this, array(
			'criteria'=>$V0v5vsnfxezw,
		));
	}
}